﻿<Window x:Class="TreeViewEx.VirtualizationSample.MainWindow"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:Controls="clr-namespace:System.Windows.Controls;assembly=TreeViewEx"
      xmlns:Model="clr-namespace:W7StyleSample.Model" Title="MainWindow" Height="350" Width="261"
      AutomationProperties.Name="TestApp2Window" x:Name="this">
	<Window.Resources>
        <HierarchicalDataTemplate ItemsSource="{Binding Children}" DataType="{x:Type Model:Node}">
			<TextBlock Text="{Binding Name}" />
        </HierarchicalDataTemplate>
	</Window.Resources>
	<DockPanel>
		<CheckBox
            IsChecked="{Binding ElementName=tree, Path=IsVirtualizing, Mode=TwoWay}"
            DockPanel.Dock="Bottom">Virtualize Items</CheckBox>
		<Button Click="OnLoad" DockPanel.Dock="Bottom">Load Items</Button>
		<Button Click="OnClear" DockPanel.Dock="Bottom">Clear Items</Button>
		<StackPanel Orientation="Horizontal" DockPanel.Dock="Bottom">
			<TextBlock>Time to load:</TextBlock>
			<TextBlock Text="{Binding TimeToLoad, ElementName=this}" />
		</StackPanel>
		<StackPanel Orientation="Horizontal" DockPanel.Dock="Bottom">
			<TextBlock>Memory after action:</TextBlock>
			<TextBlock Text="{Binding MemoryAfterLoad, ElementName=this}" />
		</StackPanel>
		<Controls:TreeViewEx x:Name="tree" DockPanel.Dock="Top"
            AutomationProperties.Name="TestApp2Tree" ItemsSource="{Binding Path=Children}" />
	</DockPanel>
</Window>
